package com.xzl.org.learning_situation_analysis.service.Impl;

import com.github.pagehelper.PageInfo;
import com.xzl.org.learning_situation_analysis.dao.ExamSessionMapper;
import com.xzl.org.learning_situation_analysis.entity.ExamSession;
import com.xzl.org.learning_situation_analysis.service.ExamSessionService;
import com.xzl.org.learning_situation_analysis.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 夏智力
 * @FileName ExamSessionServiceImpl
 * @date 2022/4/15 14:03
 * @Software: IntelliJ IDEA
 */
@Service
public class ExamSessionServiceImpl implements ExamSessionService {

    @Autowired
    private ExamSessionMapper examSessionMapper;


    @Override
    public ExamSession selectById(int id) {
        return examSessionMapper.selectById(id);
    }

    @Override
    public int insertExamSession(ExamSession examSession) {
        return examSessionMapper.insertExamSession(examSession);
    }

    @Override
    public PageInfo<ExamSession> selectCurrentPageExamSession(int currentPage, int pageSize) {
        List<ExamSession> examSessionAll = examSessionMapper.selectAll();
        PageInfo<ExamSession> page = new PageUtil<ExamSession>().getPage(currentPage,pageSize,examSessionAll);
        return page;
    }

    @Override
    public int delExamSession(int id) {
        return examSessionMapper.delExamSession(id);
    }
}
